﻿///<copyright>
/// Copyright © 2009 Stephen Styrchak. All Rights Reserved.
///</copyright>
using System;
using System.Collections.Generic;
using System.ComponentModel;
using Ferpect.ComponentModel.Design;
using Microsoft.Xna.Framework;

namespace Ferpect.ComponentModel.Sprites
{
    public enum SpriteMovementType
    {
        None,
        Linear,
        Steering,
    }

    [TypeConverter(TypeConverters.MovementInfoConverter)]
    public class MovementInfo
    {
        private List<Vector2> wayPoints;

        public MovementInfo()
        {
            this.MaxMoveSpeed = 100f;
            this.MaxTurnSpeed = MathHelper.Pi;
            this.wayPoints = new List<Vector2>();
        }

        public MovementInfo(SpriteMovementType type, float maxMoveSpeed, float maxTurnSpeed, Vector2[] wayPoints)
        {
            this.Type = type;
            this.MaxMoveSpeed = maxMoveSpeed;
            this.MaxTurnSpeed = maxTurnSpeed;
            this.wayPoints = new List<Vector2>(wayPoints);
        }

        [DefaultValue(SpriteMovementType.None)]
        public SpriteMovementType Type { get; set; }

        [DefaultValue(100f)]
        public float MaxMoveSpeed { get; set; }

        /// <summary>
        /// This is how much the Sprite can turn in one second in radians, since
        /// Pi radians makes half a circle the sprite can turn all the way around
        /// in one second.
        /// </summary>
        [DefaultValue(MathHelper.Pi)]
        public float MaxTurnSpeed { get; set; }

        [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
        public List<Vector2> WayPoints { get { return this.wayPoints; } }
    }
}
